home *** CD-ROM | disk | FTP | other *** search
-
- #include <exec/types.h>
- #include <devices/inputevent.h>
- #include <libraries/commodities.h>
-
- #include <clib/exec_protos.h>
- #include <clib/commodities_protos.h>
- #include <clib/alib_protos.h>
-
- #include "ClickFront.h"
- #include "Cx.h"
-
- #include "CxCustom.h"
-
- extern struct CxContext *Cx;
-
- /****************************************************************************
- This routine does the actual input event processing.
- The mouse-speed variable in the CxContext struct is scaled by the GUI
- routines so that 100 has no effect (100% in the GUI), 50 is half speed, etc.
- The x and y movements are scaled by multiplying them by Cx->MouseSpeed
- and dividing by 100. The significant thing about this routine is that
- the remainder is kept, and at each stage, the remainder from the previous
- movement is added. This is what avoids the jerkiness often caused by
- mouse accelerators.
- ****************************************************************************/
-
- void CxCustomRoutine(CxMsg *msg,CxObj *obj)
- {
- static int xrem=0,yrem=0,lmb;
- int x,y,msx,msy;
- struct InputEvent *e=CxMsgData(msg);
-
- x=e->ie_X; y=e->ie_Y;
- msx=Cx->MouseSpeed;
- msy=Cx->MouseSpeed;
- if(Cx->MMBShift)
- {
- if(e->ie_Qualifier & IEQUALIFIER_MIDBUTTON)
- {
- e->ie_Qualifier&=~IEQUALIFIER_MIDBUTTON;
- e->ie_Qualifier|=IEQUALIFIER_LEFTBUTTON|IEQUALIFIER_LSHIFT|IEQUALIFIER_RSHIFT;
- }
- }
- switch(e->ie_Class)
- {
- case IECLASS_RAWMOUSE:
- if(Cx->MMBShift)
- {
- if(e->ie_Code==(IECODE_MBUTTON))
- e->ie_Code=IECODE_LBUTTON;
- if(e->ie_Code==(IECODE_MBUTTON|IECODE_UP_PREFIX))
- e->ie_Code=IECODE_LBUTTON|IECODE_UP_PREFIX;
- }
- if(e->ie_Code==(IECODE_LBUTTON))
- if(Cx->ClickToFront)
- HandleClickToFront(e);
- if(msx>150)
- if(x<3 && x>-3)
- msx=100;
- if(msy>150)
- if(y<3 && y>-3)
- msy=100;
- x=e->ie_X*msx+xrem; xrem=x; x/=100; xrem-=x*100; e->ie_X=x;
- y=e->ie_Y*msy+yrem; yrem=y; y/=100; yrem-=y*100; e->ie_Y=y;
- break;
- }
- }
-
-